package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.EcologyCastExpendConf;
import com.sc.nft.entity.EcologyReforgeExpendConf;
import com.sc.nft.mapper.EcologyReforgeExpendConfMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author：LiGen
 * @Package：com.sc.nft.dao
 * @Project：sc_metago
 * @name：EcologyReforgeCastConfDao
 * @Date：2024/6/14 17:45
 * @Filename：EcologyReforgeCastConfDao
 */
@Slf4j
@Repository
public class EcologyReforgeExpendConfDao extends ServiceImpl<EcologyReforgeExpendConfMapper, EcologyReforgeExpendConf> {

    public EcologyReforgeExpendConf getOneByIdAndEcologyReforgeConfId(Long id, Long ecologyReforgeConfId) {
        return this.lambdaQuery()
                .eq(EcologyReforgeExpendConf::getId, id)
                .eq(EcologyReforgeExpendConf::getEcologyReforgeConfId, ecologyReforgeConfId)
                .one();
    }

    public List<EcologyReforgeExpendConf> getListByEcologyReforgeConfId(Long ecologyReforgeConfId) {
        LambdaQueryWrapper<EcologyReforgeExpendConf> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(EcologyReforgeExpendConf::getEcologyReforgeConfId, ecologyReforgeConfId);
        return list(wrapper);
    }

    public boolean delExpendById(Long id) {
        return this.lambdaUpdate()
                .eq(EcologyReforgeExpendConf::getId, id)
                .remove();
    }

    public boolean delByEcologyReforgeConfId(Long ecologyReforgeConfId) {
        return this.lambdaUpdate()
                .eq(EcologyReforgeExpendConf::getEcologyReforgeConfId, ecologyReforgeConfId)
                .remove();
    }
}
